<?php
if(isset($_POST['compte_particulier'])){
	 $erreurs= $this->inscrireParticulier();
}
?>
      				
<form id="monForm" method="post" onSubmit="return verifInscriptionParticulier()">
<div id ="compte_particulier">
    <div class='titre_h1_particulier'><div class="compte"><h1>compte de Particulier</h1></div></div>
</div>
    <?php if(isset($erreurs['email'])){
		echo "<pre class='erreurs'>Adresse email déjà utilisé par un autre utilisateur.</pre>";
		echo '<script>backgroundErrors("email")</script>';
	} else if(isset($erreurs['telephone'])){
		echo "<pre class='erreurs'>Le numero de téléphone exitse déjà pour un autre utilisateur.</pre>";
		echo '<script>document.getElementById("telephone").style.background ="#F38585"</script>';
	}?>
    <br />
    
	<div class="legend_formulaire_particulier"><legend>Informations Personnelles</legend></div>
    <table class="table table-hover">
    	<tr>
        	<td><label for="nom" class="control-label">Nom </label></td>
            <td><input type="text" name="nom" id="nom" required autofocus placeholder="Votre nom" 
            pattern="^[a-zA-Zéèà ]{2,}$" class="form-control"
        value="<?php echo isset($_POST['nom']) ? $_POST['nom'] : "" ?>" onBlur="document.getElementById('nom'
        ).style.background = 'white'"/>
       	 </td>
        </tr>
        <tr>
        	<td><label for="prenom">Prénom </label></td>
            <td><input type="text" name="prenom" id="prenom" required placeholder="Votre prénom" 
            pattern="^[a-zA-Zéèà ]{2,}$" class="form-control"
        value="<?php echo isset($_POST['prenom']) ? $_POST['prenom'] : "" ?>" onBlur="document.getElementById('prenom'
        ).style.background = 'white'"/>
</td>
        </tr>
        <tr>
        	<td><label for="fonction">Fonction </label></td>
            <td><input type="text" name="fonction" id="fonction" placeholder="votre fonction" pattern="^[a-zA-Zéèà ]{2,}$"
        value="<?php echo isset($_POST['fonction']) ? $_POST['fonction'] : "" ?>" 
        onBlur="document.getElementById('fonction').style.background = 'white'" class="form-control"/>
</td>
        </tr>
        <tr>
        	<td><label>Téléphone</label></td>
            <td><input type="text" name="telephone"  id="telephone" required placeholder="Votre numero de tél" pattern=
        "^0[0-9]{9}$" value="<?php echo isset($_POST['telephone']) ? $_POST['telephone'] : ""?>" onBlur=
        "document.getElementById('telephone').style.background = 'white', verifierTel('#telephone')" 
        onFocus="cacherDiv('#tel')" class="form-control"/></td>
        </tr>
        <tr>
        	<td id="tel" colspan="2"
        class="erreurs" style="display:none"></td>
        </tr>
        <tr>
        	<td><label for="adresse">Adresse </label></td>
            <td><input type="text" name="adresse" id="adresse" required placeholder="Votre adresse" 
            pattern="^[a-zA-Zéèà0-9 ]+$" 
        	value="<?php echo isset($_POST['adresse']) ? $_POST['adresse'] : "" ?>" class="form-control" />
			</td>
        </tr>
        <tr>
        	<td><label for="code_postal">Code postal </label></td>
            <td><input type="number" required id="code_postal" name="code_postal" pattern = "^[0-9]{5}$" value="<?php echo 
		isset($_POST['code_postal']) ? $_POST['code_postal'] : "" ?>" onBlur="document.getElementById('code_postal'
        ).style.background = 'white'" class="form-control"/></td>
        </tr>
        <tr>
        	<td><label for="ville">Ville</label></td>
            <td><input type="text" name="ville"  id="ville" required placeholder="Votre ville" 
            pattern="^[a-zA-Zéèà ]{2,}$"
        value="<?php echo isset($_POST['ville']) ? $_POST['ville'] : "" ?>" onBlur="document.getElementById('ville'
        ).style.background = 'white'" class="form-control"/></td>
        </tr><tr>
        
        	<td> <label for="Pays">Pays </label></td>
            <td><select name="pays" id="name" required class="form-control">
        	<option id="france">France</option>
        </select></td>
        </tr>
    </table>
        
  <div class="legend_formulaire_particulier"><legend>Compte</legend></div>
  <table class="table table-hover">
  	<tr>
    	<td><label for="email" >Email </label></td><td>
        <input type="email" name="email" id="email" required placeholder="exemple@domain.com" value="<?php echo 
		isset($_POST['email']) ? $_POST['email'] : "" ?>" onBlur="document.getElementById('email').style.background =
         'white'; verifierMail()" onFocus="cacherDiv('#erreurs')" class="form-control"/></td></tr><tr>
         <td id="erreurs" class='erreurs' style="display:none" colspan="2">
        </td></tr><tr><td>
    	<label for="password">Mot de passe</label></td><td>
        <input name="password" type="password" required id="password" placeholder=" Votre mot de passe" value="<?php echo
		isset($_POST['password']) ? $_POST['password'] : "" ?>" onBlur="document.getElementById('password'
        ).style.background = 'white';verifierPassword()" onFocus="cacherDiv('#pass')" class="form-control"/>
        </td></tr><tr><td id="pass" class="erreurs" colspan="2" style="display:none">
        
        </td></tr><tr><td>
        <label for="conf_password">Confirmez votre mot de passe </label></td><td>
      	<input name="conf_password" type="password" required id="conf_password" placeholder="Confirmez votre mot de passe" value="<?php echo isset($_POST['conf_password']) ? $_POST['conf_password'] : "" ?>" class="form-control" /></td></tr>
     	</table>
        <pre class="alert alert-info"><em>Votre mot de passe doit contenir au mois 6 charactères pour des raisons de sécurité</em></pre>
            <button class="btn btn-success"  type="submit" name="compte_particulier" title="Créer mon compte"><span class="glyphicon glyphicon-plus "></span>
            Créer compte</button>
            <button class="btn btn-warning"  type="reset">Tout Éffacer</button> 
       
    </fieldset>

</form>
